def mergeSort(li):
    n = len(li)
    if n <= 1:
        return li
    num = int(n/2)
    left = mergeSort(li[:num])
    right = mergeSort(li[num:])
    return merge(left,right)
def merge(left,right):
    result = []
    l,r = 0,0
    while l < len(left) and r < len(right) :
        if left[l] <= right[r]:
            result.append(left[l])
            l += 1
        else:
            result.append(right[r])
            r += 1
    result += left[l:]
    result += right[r:]
    return  result

alist = [54,26,93,17,77,31,44,55,20]
sorted_alist = mergeSort(alist)
print(sorted_alist)